package cn.lili.modules.supplier.entity.dos;

import cn.hutool.core.text.CharSequenceUtil;
import cn.lili.common.utils.SnowFlake;
import cn.lili.modules.store.entity.enums.SupplierAuditEnum;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

@Data
@TableName("li_supplier_audit_record")
@ApiModel(value = "供应商审核")
@NoArgsConstructor
public class SupplierAuditRecord {
    @TableId
    @ApiModelProperty(value = "唯一标识", hidden = true)
    private String id;

    @ApiModelProperty(value = "供应商ID-对应store表ID")
    private String supplierId;

    @ApiModelProperty(value = "城市站点ID")
    private String siteId;

    @ApiModelProperty(value = "城市站点核验状态")
    private boolean siteVerify = true;

    @ApiModelProperty(value = "平台核验状态")
    private boolean platformVerify = true;

    @ApiModelProperty(value = "流水号")
    private String orderNo;

    @ApiModelProperty(value = "付款金额")
    private Double paymentMoney;

    @ApiModelProperty(value = "付款状态：waitPayment待付款、paid已付款")
    private String paymentStatus;

    @ApiModelProperty(value = "剩余审核状态")
    private Integer residueAuditCount;

    @ApiModelProperty(value = "创建时间")
    private Date createTime;

    @ApiModelProperty(value = "付款时间")
    private Date paymentTime;

    public SupplierAuditRecord (String supplierId, String siteId, Integer auditCount) {
        if (CharSequenceUtil.isEmpty(getId())) {
            this.setId(SnowFlake.getIdStr());
        }
        this.setSiteId(siteId);
        this.setSupplierId(supplierId);
        this.setCreateTime(new Date());
        this.setSiteVerify(false);
        this.setPlatformVerify(false);
        this.setPaymentStatus(SupplierAuditEnum.NONPAYMENT.name());
        this.setResidueAuditCount(auditCount);
    }
}
